﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Add_pictures : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       cldDate.SelectedDate = DateTime.Today;
       if (Convert.ToString(Session["Dangnhap"]) == "")
           Response.Redirect("~/Admin/Login.aspx");

       else
           Response.Write("Xin chào " + Convert.ToString(Session["Dangnhap"]));
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlDataSource1.Insert();
        SaveFileUpload();
        lblMsg.Text = " Add picture successfully";
    }
    private void SaveFileUpload()
    {
        string strFilename;
        if (FileUpload.FileName != "")
        {
            strFilename = Server.MapPath("~/App_Data/upload/Picture\\" + FileUpload.FileName);
            FileUpload.PostedFile.SaveAs(strFilename);
        }
    }
}
